<?php

namespace App\BO\Distributor\Meta;

class BindRelationShip
{
    /**
     * 用户ID
     * @var int
     */
    private $userId;

    /**
     * 一级邀请人
     * @var UserDistributorRate
     */
    private $pUser;

    /**
     * 二级邀请人
     * @var UserDistributorRate
     */
    private $ppUser;

    /**
     * @return int
     */
    public function getUserId(): int
    {
        return $this->userId;
    }

    /**
     * @param int $userId
     */
    public function setUserId(int $userId): void
    {
        $this->userId = $userId;
    }

    /**
     * @return UserDistributorRate|null
     */
    public function getPUser()
    {
        return $this->pUser;
    }

    /**
     * @param UserDistributorRate $pUser
     */
    public function setPUser(UserDistributorRate $pUser): void
    {
        $this->pUser = $pUser;
    }

    /**
     * @return UserDistributorRate|null
     */
    public function getPpUser()
    {
        return $this->ppUser;
    }

    /**
     * @param UserDistributorRate $ppUser
     */
    public function setPpUser(UserDistributorRate $ppUser): void
    {
        $this->ppUser = $ppUser;
    }

    /**
     * @return UserDistributorRate[]
     */
    public function getAllDistributors(): array
    {
        $ret = [];
        if (!is_null($this->pUser)) {
            $ret[] = $this->pUser;
        }

        if (!is_null($this->ppUser)) {
            $ret[] = $this->ppUser;
        }

        return $ret;
    }
}
